A. Field of the Invention
The present invention relates to a method for image auto-cropping, especially to a method for auto-cropping images with irregular boundaries.
B. Description of the Prior Art
The optical image scanners available in the market usually provide a pre-scan function which is capable of automatically cropping the area of interest (AOI) from the scanned image by a bounding rectangle. For instance, cropping a star figure as illustrated in FIG. 1, the actual area cropped is a rectangular area rather than the target star figure. Thus, the data required for image processing will inevitably include a great amount of undesirable data. The user would have to manually delete the background image data in the area cropped to get the target star figure. Moreover, since the current cropping algorithms are still not efficient enough, therefore the speed of auto-cropping is time-consuming.
For artistic figures, such as the figures scanned for Internet applications, the figures are usually not in uniform shape. If an artistic figure is cropped using the conventionally method, then the AOI will be selected by a bounding rectangle. Then, the background image has to be converted into uniform color. After that, the user may apply an application tool to manually set the background image as transparent. Finally, the artistic figure can be stored in a file format accessible for Internet applications. Thus, the image processing for the auto-cropped image has to be processed by experienced software engineers. For large volume scanning and auto-cropping, it is desirable to provide a function in a scanner application software for auto-cropping an artist figure directly from its border, thereby to enhance productivity, popularity and save the cost.
Accordingly, it is a primary object of the present invention to provide a method for auto-cropping an image with irregular boundaries, thereby to enhance the productivity and promote the functions of an optical scanner.
It is another object of the present invention to provide an efficient method for image auto-cropping which can precisely crop the area of interest from its border line, thereby to reduce the amount of background data required for further processing and thus improve the efficiency of auto-cropping.
In accordance with the present invention, a method for automatically cropping the area of interest from a pre-scanned image is provided. A pattern sheet is provided on the bottom surface side of the cover of the optical scanner. The pattern sheet is defined by multiple pattern units for serving as referential coordinates. When the scanner is initialized, the pattern sheet is pre-scanned to generate a pre-scanned image. The pre-scanned image of the pattern sheet will be analyzed to get the referential data, including the index, the referential intensity level, and the pixel-positions of each pattern unit. The referential data of each pattern unit will be stored in a database. When auto-cropping an area of interest (AOI) from a pre-scanned image, the pre-scanned image of the original will be logically divided into multiple document blocks according to the positions of pattern units. Then, compare each document block with its correspondent pattern unit to determine if the document block contains AOI data. If the intensity-level difference between the document block and its correspondent pattern unit is larger than a default value, then record the index of the document block. After finishing the comparison, group the adjacent document blocks recorded as a region. Finally, crop each region formed from its border line to obtain the desired AOI.